import java.io.*;

public class C079_2 {
	public static String smoke(String[] refSpInput) {
		int n, k;
		int ass = 0, more = 0;
		
		n = Integer.parseInt(refSpInput[0]);
		k = Integer.parseInt(refSpInput[1]);
		
		for(int i = n; i > 0; i--) {
			if(ass == k) {
				i++;
				more++;
				ass = 1;
			} else {
				ass++;
			}
		}
		
		return ((n + more) + "\n");
	}
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String input;
		String[] spInput;
		StringBuffer output = new StringBuffer();
		
		while((input = br.readLine()) != null) {
			spInput = input.split(" ");
			
			output.append(smoke(spInput));
		}
		
		System.out.print(output);
	}
}